﻿using UnityEngine;

namespace ProjectDanmaku.Entity.Manipulator
{
    public class ScreenBoundCheckManipulator : IEntityManipulator
    {
        protected virtual bool CheckOutOfScreen(Vector2 position)
        {
            return position.x <= -5.6 || position.x >= 5.6 || position.y <= -3.9 || position.y >= 3.9;
        }
        
        public void Do(EntityData entityData)
        {
            if (CheckOutOfScreen(entityData.Position))
            {
                entityData.Destroyed = true;
                entityData.Active = false;
            }
        }
    }
}